abstract class $RO_MAP{K,E} < $CONTAINER{E}, $STR
****
A read-only map abstraction that does not permit modifications. A mapping abstraction from elements of type K to elements of type E A map stores an element of type E under a key of type K. Each key can hold one element.
_
Design note: It would also be reasonable to have a $RO_MAP be a subtype of $CONTAINER{TUP{K,E}}. However, since we are using the array notation, to avoid confusion with the way arrays behave we view maps as containers of the target elements, with the keys being a kind of indexing method. Arrays are then a special kind of map where the keys are integers. Though we don't make use of this possibility in this library, the use of array notation is consistent with it.


Ancestors
$STR $CONTAINER{_} $ELT{_} $ELT

Descendants
$MAP{_,_} H_MAP{_,_} MAP{_,_} B_TREE_DBG{_,_}



Public


Features
aget(k:K): E;
**** Returns the element k is mapped to. If k is absent:
________If_E_<_$IS_NIL_return_E::nil_othewise_return_void_
has_elt(e: E): BOOL;
**** Same as "has"
has_ind(k:K): BOOL;
**** Returns 'true' if 'k' is mapped to an element.
ind!: K;
**** Yields the indices (keys) of the mapping
pair!: TUP{K,E};
**** Yields the the elements or a tuple containing both in arbitrary order.

The Sather Home Page